package com.ctgu.fcftsystem.service;

import com.ctgu.fcftsystem.dao.SharesholderDao;
import com.ctgu.fcftsystem.pojo.Sharesholder;
import com.ctgu.fcftsystem.pojo.Spend;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SharesholderServiceImpl implements SharesholderService {

    @Autowired
    private SharesholderDao sharesholderDao;

    @Override
    public List<Sharesholder> findByPaging(int pageCount, int pageSize) {
        return sharesholderDao.findByPaging(pageCount, pageSize);
    }

    /**
     * 添加持股记录
     * @param sharesholder
     * @return
     */
    @Override
    public int addSharesholderDao(Sharesholder sharesholder) {
        return sharesholderDao.addSharesholderDao(sharesholder);
    }

    /**
     * 根据股票名称、holder和证券用户等多重条件查询持股信息
     * @param sharesName
     * @param holder
     * @param securitiesId
     * @return
     */
    @Override
    public List<Sharesholder> searchSharesholder(String sharesName, String holder, Integer securitiesId) {
        return  sharesholderDao.searchSharesholder(sharesName, holder, securitiesId);
    }


    /**
     * 根据id删除持股信息
     * @param id
     * @return
     */
    @Override
    public int deleteSharesholderById(Integer id) {
        return sharesholderDao.deleteSharesholderById(id);
    }


    /**
     * 根据id维护持股信息
     * @return
     */
    @Override
    public int updateSharesholderById(Sharesholder sharesholder) {
        return sharesholderDao.updateSharesholderById(sharesholder);
    }
}
